package com.xuanyuan.material

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.button.MaterialButton
import com.google.android.material.shape.AbsoluteCornerSize
import com.google.android.material.shape.CornerFamily
import com.google.android.material.shape.RelativeCornerSize
import com.google.android.material.shape.ShapeAppearanceModel


/**
 * Copyright (C), 2017-2022, Anker
 * FileName: BottomAppBarActivity
 *
 * @author ken.luo
 * Date: 2022/6/9 15:06
 * Description: 要求Activity的主题必须是MaterialComponents的主题
 * History:
 * 创建者 : ken.luo
 * <author>     <time>     <version>      <desc>
 * 作者姓名      修改时间      版本号          描述
</desc></version></time></author> */

class MaterialButtonActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_material_button)
        initView()

    }

    private fun initView() {
        val imageView = findViewById<MaterialButton>(R.id.ivMB)

        imageView?.shapeAppearanceModel = ShapeAppearanceModel.builder()
            .setAllCorners(CornerFamily.ROUNDED, 20f)
            .setTopLeftCorner(CornerFamily.CUT, RelativeCornerSize(0.3f))
            .setTopRightCorner(CornerFamily.CUT, RelativeCornerSize(0.3f))
            .setBottomRightCorner(CornerFamily.CUT, RelativeCornerSize(0.3f))
            .setBottomLeftCorner(CornerFamily.CUT, RelativeCornerSize(0.3f))
            .setAllCornerSizes(ShapeAppearanceModel.PILL)
            .setTopLeftCornerSize(20f)
            .setTopRightCornerSize(RelativeCornerSize(0.5f))
            .setBottomLeftCornerSize(10f)
            .setBottomRightCornerSize(AbsoluteCornerSize(30f))
            .build()

    }

}






